<?php

namespace App\Http\Requests\Landscaping;

use Illuminate\Foundation\Http\FormRequest;
use App\Http\Requests\BaseRequest;

class ParkProtectRequest extends BaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'landscaping_id' => 'required',
            'protect_month' => 'required|integer|between:1,12',
            'protect_content' => 'required',
            'protect_type' => 'required',
            'protect_number' => 'required|integer',
            'protect_units' => 'required',
            'begin_time' => 'required|date',
            'end_time' => 'required|date',
            'protect_job' => 'required',
            'protect_principal_id' => 'required|integer',
            'protect_remark' => 'required'
        ];
    }

    public function messages() 
    {
        return [
            'landscaping_id.required' => '园林ID不能为空',
            'protect_month.required' => '作业月份不能为空',
            'protect_month.between' => '作业月份不合法',
            'protect_month.integer' => '作业月份只能填写数字',
            'protect_content.required' => '作业内容不能为空',
            'protect_type.required' => '除草类型不能为空',
            'protect_number.required' => '植物数量不能为空',
            'protect_number.integer' => '植物数量只能填写数字',
            'protect_units.required' => '单位不能为空',
            'begin_time.required' => '作业开始时间不能为空',
            'begin_time.date' => '作业开始时间格式不正确',
            'end_time.required' => '作业结束时间不能为空',
            'end_time.date' => '作业结束时间格式不正确',
            'protect_job.required' => '作业种类不能为空',
            'protect_principal_id.required' => '负责人id不能为空',
            'protect_principal_id.integer' => '负责人id只能填写数字',
            'protect_remark.required' => '完成度不能为空'
        ];
    }

}
